package com.wsd.bookkeeping.entity.query;

import com.wsd.common.utils.DateUtils;
import lombok.Getter;
import lombok.Setter;

import java.util.Calendar;
import java.util.Date;

@Getter
@Setter
public class AccountSummaryQuery {

    private Integer bookId;
    private String type;
    private String yearStart;
    private String yearEnd;

    /**
     * 设置启始日期
     * @return this
     */
    public AccountSummaryQuery init() {
        Calendar instance = Calendar.getInstance();
        instance.setTime(new Date());

        instance.set(Calendar.DAY_OF_YEAR, 1);
        yearStart = DateUtils.toNString(instance.getTime());

        instance.set(Calendar.DAY_OF_YEAR, instance.getActualMaximum(Calendar.DAY_OF_YEAR));
        yearEnd = DateUtils.toNString(instance.getTime());
        return this;
    }
}
